package redisconn

import (
	"cybertwin/utils/configtools"

	"github.com/redis/go-redis/v9"
	log "github.com/sirupsen/logrus"
)

var Conn *redis.Client

func init() {
	Conn = NewRedisConn()
}

func NewRedisConn() (res *redis.Client) {
	addr := configtools.GlobalConfiguration.GetString("redis.addr")
	res = redis.NewClient(&redis.Options{
		Addr: addr,
	})
	log.Infof("[NewRedisConn]-成功连接至Redis数据库: %s", addr)
	return
}
